//
//  Drawing.m
//  Sirtet
//
//  Created by Seán Hargadon on 04/09/2012.
//  Copyright (c) 2012 Conor Taylor. All rights reserved.
//

#import "Drawing.h"

@implementation Drawing

int shapeToBeDrawn;

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setNeedsDisplay:YES];
    }
    
    return self;
}

- (void)createShape:(int)x withType:(int)y{
    y = shapeToBeDrawn;
    [self setNeedsDisplay:YES];
}

- (void)manipulateShape:(int)x withAngle:(float)y {
    
}

- (void)drawRect:(NSRect)dirtyRect {
    NSGraphicsContext * GraphicsContext = [NSGraphicsContext currentContext];
    CGContextRef context = (CGContextRef) [GraphicsContext graphicsPort];
    
    
    //line
    if (shapeToBeDrawn == 0) {
        CGRect rect[4];
        rect[0] = CGRectMake(150, 520, 10, 10);
        CGContextSetRGBFillColor(context, 0, 0.0, 0.0, 1); // black fill
        CGContextFillRect(context, rect[0]);
    }
    
    
//    CGContextSelectFont (context, "Helvetica", 1, kCGEncodingMacRoman);
//    CGContextSetCharacterSpacing (context, .5);
//    CGContextSetTextDrawingMode (context, kCGTextFillStroke);
    
//    for (int i = 0; i < 100; i++) {
//        CGPoint random = CGPointMake(arc4random()%500, arc4random()%500);
//        CGContextSetRGBStrokeColor (context, (rand()/100), 0.0, 0.0, 1);
//        CGContextShowTextAtPoint (context, random.x, random.y, "Sirtet", 6);
//    }
}

@end
